Skip to content

Conversation

@andykaylor
Copy link
Contributor

This fixes a test case in the clang/CIR/CodeGen/statement-exprs.c test. The test case was copied from a similar test in clang/CodeGen/exprs.c and was recently broken by #166036 which corrects Clang's behavior with trailing NullStmts. This change updates the CIR test in the same way that the classic codegen test was updated, removing the trailing null part of the expression.

This fixes a test case in the clang/CIR/CodeGen/statement-exprs.c test. The
test case was copied from a similar test in clang/CodeGen/exprs.c and was
recently broken by llvm#166036 which
corrects Clang's behavior with trailing NullStmts. This change updates
the CIR test in the same way that the classic codegen test was updated,
removing the trailing null part of the expression.
@llvmbot llvmbot added clang Clang issues not falling into any other category ClangIR Anything related to the ClangIR project labels Nov 7, 2025
@llvmbot
Copy link
Member

llvmbot commented Nov 7, 2025

@llvm/pr-subscribers-clang

Author: Andy Kaylor (andykaylor)

Changes

This fixes a test case in the clang/CIR/CodeGen/statement-exprs.c test. The test case was copied from a similar test in clang/CodeGen/exprs.c and was recently broken by #166036 which corrects Clang's behavior with trailing NullStmts. This change updates the CIR test in the same way that the classic codegen test was updated, removing the trailing null part of the expression.


Full diff: https://github.com/llvm/llvm-project/pull/167000.diff

1 Files Affected:

  • (modified) clang/test/CIR/CodeGen/statement-exprs.c (+1-1)
diff --git a/clang/test/CIR/CodeGen/statement-exprs.c b/clang/test/CIR/CodeGen/statement-exprs.c
index c784ec9eda7d8..5925515997270 100644
--- a/clang/test/CIR/CodeGen/statement-exprs.c
+++ b/clang/test/CIR/CodeGen/statement-exprs.c
@@ -6,7 +6,7 @@
 // RUN: FileCheck --input-file=%t.ll %s --check-prefix=OGCG
 
 int f19(void) {
-  return ({ 3;;4;; });
+  return ({ 3;;4; });
 }
 
 // CIR: cir.func dso_local @f19() -> !s32i

@llvmbot
Copy link
Member

llvmbot commented Nov 7, 2025

@llvm/pr-subscribers-clangir

Author: Andy Kaylor (andykaylor)

Changes

This fixes a test case in the clang/CIR/CodeGen/statement-exprs.c test. The test case was copied from a similar test in clang/CodeGen/exprs.c and was recently broken by #166036 which corrects Clang's behavior with trailing NullStmts. This change updates the CIR test in the same way that the classic codegen test was updated, removing the trailing null part of the expression.


Full diff: https://github.com/llvm/llvm-project/pull/167000.diff

1 Files Affected:

  • (modified) clang/test/CIR/CodeGen/statement-exprs.c (+1-1)
diff --git a/clang/test/CIR/CodeGen/statement-exprs.c b/clang/test/CIR/CodeGen/statement-exprs.c
index c784ec9eda7d8..5925515997270 100644
--- a/clang/test/CIR/CodeGen/statement-exprs.c
+++ b/clang/test/CIR/CodeGen/statement-exprs.c
@@ -6,7 +6,7 @@
 // RUN: FileCheck --input-file=%t.ll %s --check-prefix=OGCG
 
 int f19(void) {
-  return ({ 3;;4;; });
+  return ({ 3;;4; });
 }
 
 // CIR: cir.func dso_local @f19() -> !s32i

Copy link
Member

@AmrDeveloper AmrDeveloper left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, Thanks

Copy link
Contributor

@mmha mmha left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

#166036 removed that semicolon, but it also added a new test. Maybe we should copy that over, too.

@andykaylor andykaylor merged commit 1b2eee5 into llvm:main Nov 7, 2025
13 checks passed
@andykaylor
Copy link
Contributor Author

#166036 removed that semicolon, but it also added a new test. Maybe we should copy that over, too.

The new test there looks a bit dubious. It's only checking that a void return is generated, which doesn't really have anything to do with the expression handling. The AST tells us the return type and sets up the implicit cast to void in this case. It could be interesting to verify that we are emitting code for any sub-expression with side effects, but I think that is covered elsewhere.

@andykaylor andykaylor deleted the cir-stmtexpr-test branch November 7, 2025 21:23
vinay-deshmukh pushed a commit to vinay-deshmukh/llvm-project that referenced this pull request Nov 8, 2025
This fixes a test case in the clang/CIR/CodeGen/statement-exprs.c test.
The test case was copied from a similar test in clang/CodeGen/exprs.c
and was recently broken by
llvm#166036 which corrects Clang's
behavior with trailing NullStmts. This change updates the CIR test in
the same way that the classic codegen test was updated, removing the
trailing null part of the expression.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

clang Clang issues not falling into any other category ClangIR Anything related to the ClangIR project

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants